package com.example.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: 21050134
 * @date: 2023/11/7 11:53
 * @description:
 */
@RestController
public class TestController {

	@RequestMapping("/test")
	//@PreAuthorize("hasAnyAuthority('test')")
//    @PreAuthorize("hasAnyAuthority('admin','test','system:dept:list')")
//    @PreAuthorize("hasRole('system:dept:list')")  //需要加上前缀ROLE_才能通过
//    @PreAuthorize("hasAnyRole('admin','system:dept:list')")//需要加上前缀ROLE_才能通过
//    @PreAuthorize("hasAuthority('system:dept:list111')")
	//自定义的权限功能
	@PreAuthorize("@ex.hasAuthority('system:dept:list')")
	public String test(){
		return "Test";
	}
}
